<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<style type="text/css">
	body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
	</style>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=3d6a9f4b807441569414b01eecc20959"></script>
	<title>地图展示</title>
<style type="text/css">
	/**
	 * 设置地图大小
	 */
	#allmap {
		width: 50%;
		height: 800px;
	}
	/**
	 * 去除百度logo
	 */
	.BMap_cpyCtrl {
		display: none;
	}
	.anchorBL {
		display: none;
	}
</style>
</head>
<body>
	<div id="allmap"></div>
  <input type="text" name="workAddress" id="workAddress">
</body>
</html>
<script src="../../static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
	// 百度地图API功能
	var map = new BMap.Map("allmap");
	map.centerAndZoom("武汉市",6);
	map.addControl(new BMap.NavigationControl());
	map.addControl(new BMap.MapTypeControl());
	map.addControl(new BMap.OverviewMapControl());
	map.addControl(new BMap.GeolocationControl({anchor: BMAP_ANCHOR_BOTTOM_LEFT}));
	map.addControl(new BMap.CityListControl({anchor: BMAP_ANCHOR_BOTTOM_LEFT}));
	map.enableScrollWheelZoom(true);


	var localSearch1 = new BMap.LocalSearch(map);
	localSearch1.search("湖北省武汉市");
	localSearch1.setSearchCompleteCallback(function(searchResult) {
		var poi = searchResult.getPoi(0);
		var myIcon = new BMap.Icon("http://lbsyun.baidu.com/jsdemo/img/fox.gif", new BMap.Size(300, 157));
		var marker = new BMap.Marker(new BMap.Point(poi.point.lng, poi.point.lat), {icon: myIcon});
		// marker.setAnimation(BMAP_ANIMATION_BOUNCE);
		map.addOverlay(marker);
	});

  var localSearch2 = new BMap.LocalSearch(map);
  localSearch2.search("福建省福州市");
  localSearch2.setSearchCompleteCallback(function(searchResult) {
    var poi = searchResult.getPoi(0);
    var myIcon = new BMap.Icon("http://lbsyun.baidu.com/jsdemo/img/fox.gif", new BMap.Size(300, 157));
    var marker = new BMap.Marker(new BMap.Point(poi.point.lng, poi.point.lat), {icon: myIcon});
    // marker.setAnimation(BMAP_ANIMATION_BOUNCE);
    map.addOverlay(marker);
    var sContent = $("#workAddress").val() + "2017年到此一游"
    var infoWindow = new BMap.InfoWindow(sContent); // 创建信息窗口对象
    map.openInfoWindow(infoWindow, poi.point); //开启信息窗口
    marker.addEventListener("click", function() {
      this.openInfoWindow(infoWindow);
    });
  });
</script>
